<?php
/**
 * Created by PhpStorm.
 * User: Jason
 * Date: 2017/8/12
 * Time: 17:31
 */

namespace Admin\Service;


class SheetRecordService
{
    /**
     * 获取曲谱录音数
     */
    public function multiRecordCount($sheetIds)
    {
        $model = M('SheetRecord');
        $map = array(
            'sheet_id' => array('in', $sheetIds),
            'is_delete' => 0
        );

        $res = $model->field('sheet_id, count(*)')->where($map)->group('sheet_id')->select();
        $recordCountMap = array();
        foreach ($res as $key => $val) {
            $recordCountMap[$val['sheet_id']] = $val['count(*)'];
        }
        return $recordCountMap;
    }
}